import win32api
import netbios
'''
Created on 2011-4-20

@author: Narcissu
'''
print win32api.GetComputerName()
print win32api.GetDomainName()
print win32api.GetVersion()
print netbios.win32wnet.WNetGetUser()
print netbios.NAME_BUFFER()
print netbios.ACTION_HEADER_ITEMS


ncb = netbios.NCB()
ncb.Command = netbios.NCBENUM
la_enum = netbios.LANA_ENUM()
ncb.Buffer = la_enum
rc = netbios.Netbios(ncb)
if rc != 0: raise RuntimeError("Unexpected result %d" % (rc,))
for i in range(la_enum.length):
    ncb.Reset()
    ncb.Command = netbios.NCBRESET
    ncb.Lana_num = netbios.byte_to_int(la_enum.lana[i])
    rc = netbios.Netbios(ncb)
    if rc != 0: raise RuntimeError("Unexpected result %d" % (rc,))
    ncb.Reset()
    ncb.Command = netbios.NCBASTAT
    ncb.Lana_num = netbios.byte_to_int(la_enum.lana[i])
    ncb.Callname = "*               ".encode("ascii") # ensure bytes on py2x and 3k
    adapter = netbios.ADAPTER_STATUS()
    ncb.Buffer = adapter
    netbios.Netbios(ncb)
    print "Adapter address:",
    for ch in adapter.adapter_address:
        print "%02x" % (netbios.byte_to_int(ch),) ,
    print

for ch in netbios.ADAPTER_STATUS().adapter_address:
    print "%02x" % (netbios.byte_to_int(ch),) ,